package chapter3.test3;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

@Aspect
public class Audience {

    @Pointcut("execution(* chapter3.test3.Performance.perform(..))")
    public void perform(){}

    @Before("perform()")
    public void before(){
        System.out.println("before");
    }
    @After("perform()")
    public void after(){
        System.out.println("after");
    }
    @AfterReturning("perform()")
    public void afterReturning(){
        System.out.println("afterReturning");
    }
    @AfterThrowing("perform()")
    public void afterThrowing(){
        System.out.println("afterThrowing");
    }
    @Around("perform()")
    public void around(ProceedingJoinPoint jp){
        System.out.println("around");
        try {
            jp.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }


}
